package com.huashi.dealer.modular.business.goods.param;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * API商品响应参数
 *
 * @author 谭陈强
 * @since 2025-07-30
 */
@Data
@Schema(description = "API商品响应参数")
public class GoodsResponseParam {

    @Schema(description = "商品详情")
    private GoodsDetail detail;

    @Schema(description = "商品列表")
    private List<GoodsInfo> goodsList;

    @Schema(description = "商品分类列表")
    private List<CategoryInfo> categoryList;

    @Schema(description = "购物车商品总数量")
    private Integer cartTotalNum;

    @Schema(description = "商品海报")
    private String poster;

    @Schema(description = "总数")
    private Long total;

    @Schema(description = "当前页")
    private Integer currentPage;

    @Schema(description = "每页数量")
    private Integer perPage;

    @Schema(description = "最后页")
    private Integer lastPage;

    @Data
    @Schema(description = "商品详情")
    public static class GoodsDetail {
        @Schema(description = "商品ID")
        private Long goodsId;

        @Schema(description = "商品名称")
        private String goodsName;

        @Schema(description = "商品卖点")
        private String sellingPoint;

        @Schema(description = "商品分类ID")
        private Long categoryId;

        @Schema(description = "条形码")
        private String barCode;

        @Schema(description = "商品规格：10单规格，20多规格")
        private Integer specType;

        @Schema(description = "库存计算方式：10下单减库存，20付款减库存")
        private Integer deductStockType;

        @Schema(description = "商品排序")
        private Integer goodsSort;

        @Schema(description = "配送模板ID")
        private Long deliveryId;

        @Schema(description = "是否开启积分赠送：1开启，0关闭")
        private Integer isPointsGift;

        @Schema(description = "是否允许使用积分抵扣：1允许，0不允许")
        private Integer isPointsDiscount;

        @Schema(description = "是否开启等级权益：1开启，0关闭")
        private Integer isEnableGrade;

        @Schema(description = "是否独立等级权益：1是，0否")
        private Integer isAloneGrade;

        @Schema(description = "独立等级权益")
        private String aloneGradeEquity;

        @Schema(description = "是否独立经销商：1是，0否")
        private Integer isIndDealer;

        @Schema(description = "经销商金额类型")
        private Integer dealerMoneyType;

        @Schema(description = "一级金额")
        private BigDecimal firstMoney;

        @Schema(description = "二级金额")
        private BigDecimal secondMoney;

        @Schema(description = "三级金额")
        private BigDecimal thirdMoney;

        @Schema(description = "商品状态")
        private GoodsStatus goodsStatus;

        @Schema(description = "商品类型")
        private Integer isType;

        @Schema(description = "商品图片")
        private String goodsImage;

        @Schema(description = "商品内容")
        private String content;

        @Schema(description = "商品SKU")
        private GoodsSku goodsSku;

        @Schema(description = "商品分类")
        private CategoryInfo category;

        @Schema(description = "创建时间")
        private LocalDateTime createTime;

        @Schema(description = "更新时间")
        private LocalDateTime updateTime;
    }

    @Data
    @Schema(description = "商品信息")
    public static class GoodsInfo {
        @Schema(description = "商品ID")
        private Long goodsId;

        @Schema(description = "商品名称")
        private String goodsName;

        @Schema(description = "商品卖点")
        private String sellingPoint;

        @Schema(description = "商品分类ID")
        private Long categoryId;

        @Schema(description = "条形码")
        private String barCode;

        @Schema(description = "商品规格：10单规格，20多规格")
        private Integer specType;

        @Schema(description = "库存计算方式：10下单减库存，20付款减库存")
        private Integer deductStockType;

        @Schema(description = "商品排序")
        private Integer goodsSort;

        @Schema(description = "配送模板ID")
        private Long deliveryId;

        @Schema(description = "是否开启积分赠送：1开启，0关闭")
        private Integer isPointsGift;

        @Schema(description = "是否允许使用积分抵扣：1允许，0不允许")
        private Integer isPointsDiscount;

        @Schema(description = "是否开启等级权益：1开启，0关闭")
        private Integer isEnableGrade;

        @Schema(description = "是否独立等级权益：1是，0否")
        private Integer isAloneGrade;

        @Schema(description = "独立等级权益")
        private String aloneGradeEquity;

        @Schema(description = "是否独立经销商：1是，0否")
        private Integer isIndDealer;

        @Schema(description = "经销商金额类型")
        private Integer dealerMoneyType;

        @Schema(description = "一级金额")
        private BigDecimal firstMoney;

        @Schema(description = "二级金额")
        private BigDecimal secondMoney;

        @Schema(description = "三级金额")
        private BigDecimal thirdMoney;

        @Schema(description = "商品状态")
        private GoodsStatus goodsStatus;

        @Schema(description = "商品类型")
        private Integer isType;

        @Schema(description = "商品图片")
        private String goodsImage;

        @Schema(description = "商品内容")
        private String content;

        @Schema(description = "商品SKU")
        private GoodsSku goodsSku;

        @Schema(description = "商品分类")
        private CategoryInfo category;

        @Schema(description = "创建时间")
        private LocalDateTime createTime;

        @Schema(description = "更新时间")
        private LocalDateTime updateTime;
    }

    @Data
    @Schema(description = "商品状态")
    public static class GoodsStatus {
        @Schema(description = "状态文本")
        private String text;

        @Schema(description = "状态值")
        private Integer value;
    }

    @Data
    @Schema(description = "商品SKU")
    public static class GoodsSku {
        @Schema(description = "SKU ID")
        private Long goodsSkuId;

        @Schema(description = "SKU名称")
        private String skuName;

        @Schema(description = "SKU规格")
        private String skuSpec;

        @Schema(description = "SKU价格")
        private BigDecimal skuPrice;

        @Schema(description = "SKU库存")
        private Integer skuStock;

        @Schema(description = "SKU图片")
        private String skuImage;

        @Schema(description = "SKU重量")
        private BigDecimal skuWeight;

        @Schema(description = "SKU编码")
        private String skuCode;

        @Schema(description = "SKU状态")
        private Integer skuStatus;
    }

    @Data
    @Schema(description = "商品分类信息")
    public static class CategoryInfo {
        @Schema(description = "分类ID")
        private Long categoryId;

        @Schema(description = "分类名称")
        private String categoryName;

        @Schema(description = "分类图片")
        private String categoryImage;

        @Schema(description = "分类排序")
        private Integer categorySort;

        @Schema(description = "是否商品类型")
        private Integer isGoodsType;

        @Schema(description = "分类状态")
        private Integer categoryStatus;

        @Schema(description = "创建时间")
        private LocalDateTime createTime;

        @Schema(description = "更新时间")
        private LocalDateTime updateTime;
    }
} 